package com.ce.service.impl;

import com.ce.entity.SalesList;
import com.ce.mapper.SalesListMapper;
import com.ce.service.SalesListService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 销售记录表 服务实现类
 * </p>
 *
 * @author jyt
 * @since 2022-03-02
 */
@Service
public class SalesListServiceImpl extends ServiceImpl<SalesListMapper, SalesList> implements SalesListService {
    @Resource
    private SalesListMapper mapper;

    @Override
    public List<SalesList> getList(SalesList salesList) {
        return mapper.selectList(salesList);
    }

    @Override
    public List<SalesList> getSalesList(SalesList salesList) {
        return mapper.selectSalesList(salesList);
    }

    @Override
    public List<SalesList> getListForPrice() {
        return mapper.selectSalesListPrice();
    }

    @Override
    public Integer deleteById(Integer id) {
        Integer ret = mapper.deleteById(id);

        return ret;
    }

    @Override
    public Map<String, String> addSalesList(SalesList salesList) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("mode", "insert one SalesList");
        mapper.insert(salesList);
        return map;
    }

    @Override
    public Map<String, String> updateSalesList(SalesList salesList) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("mode", "update one SalesList");
        mapper.updateById(salesList);
        return map;
    }

    @Override
    public int selectSaleMonthCount() {
        return mapper.selectSaleMonthCount();
    }

    @Override
    public int selectCount() {
        return mapper.selectCount();
    }

    @Override
    public double selectAllPrice() {
        return mapper.selectAllPrice();
    }
}
